import requests
import os
###
headers = {
    'Accept-Encoding': 'gzip, deflate, sdch',
    'Accept-Language': 'en-US,en;q=0.8',
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
    'Referer': 'http://www.wikipedia.org/',
    'Connection': 'keep-alive',
}

res = requests.get('https://www.mianshiya.com/bank/1810641622782836737', headers=headers)   # http://en.wikipedia.org/

#利用os模块弄一个 base_dir 位置到 面试呀文件夹下
base_dir = os.path.dirname(os.path.abspath(__file__))

base_dir = os.path.join(base_dir, 'static')
# print(base_dir)
file_name = base_dir+ '/' + 'Go底层原理面试题.html'
# exit()
with open(file_name, 'w', encoding='utf-8') as f:
    f.write(res.text)